﻿<%@ Control Language="C#" AutoEventWireup="true" Codebehind="MainScreen.ascx.cs" Inherits="CMS.Web.ListManager.MainScreen" %>
<table cellspacing="0" cellpadding="0" width="98%" border="0" align="center">
    <tr>
        <td align="left" class="Text_Main" id="tdSumNow" colspan=4></td>
    </tr>
    <tr style="padding-top: 5px;">
        <td align="left" class="Text_Main" id="tdSumDonThu" colspan=4></td>
    </tr>  
    <tr>
        <td valign=top align=center style="width:25%;background-color:#b7dffe;">
            <table cellspacing="0" cellpadding="0" width="100%" border="0" align="center">
                <tbody id="tbdLoaiDon">
                    <tr id="loaiDonTitle"> 
                        <td valign="middle" align="left" class="Text_Main" style="padding-left: 10px; padding-top:10px;"> 
                            <strong>1. Theo loại đơn:</strong></td>                        
                    </tr>
                    <tr id="loaiDonPattern" style="display: none">
                        <td id="tdLoaiDon" valign="middle" align="left" class="Col_Left"> 
                        </td>                        
                    </tr>
                </tbody> 
            </table>
        </td>
        <td valign=top align=center style="width:25%;background-color:#9ed3fc;">
            <table cellspacing="0" cellpadding="0" width="100%" border="0" align="center">
                <tbody id="tbdLinhVuc">
                    <tr id="linhVucTitle">
                        <td valign="middle" align="left" class="Text_Main" style="padding-left: 10px; padding-top:10px;"> 
                            <strong>2. Theo lĩnh vực:</strong></td>                        
                    </tr>
                    <tr id="linhVucPattern" style="display: none">
                        <td id="tdLinhVuc" valign="middle" align="left" class="Col_Left"> 
                        </td>                        
                    </tr>
                </tbody>  
            </table>
        </td>
        <td valign=top align=center style="width:25%;background-color:#7ec6fd;">
            <table cellspacing="0" cellpadding="0" width="100%" border="0" align="center">
                <tbody id="tbdDiaBan">
                    <tr id="diaBanTitle">
                        <td valign="middle" align="left" class="Text_Main" style="padding-left: 10px; padding-top:10px;"> 
                            <strong>3. Theo địa bàn:</strong></td>                        
                    </tr>
                    <tr id="diaBanPattern" style="display: none">
                        <td id="tdDiaBan" valign="middle" align="left" class="Col_Left"> 
                        </td>                        
                    </tr>
                </tbody>  
            </table>
        </td>
        <td valign=top align=center style="width:25%;background-color:#58b5fc;">
            <table cellspacing="0" cellpadding="0" width="100%" border="0" align="center">
                <tbody id="tbdXuLy">
                    <tr id="xuLyTitle">
                        <td valign="middle" align="left" class="Text_Main" style="padding-left: 10px; padding-top:10px;"> 
                            <strong>4. Tình trạng xử lý:</strong></td>                        
                    </tr>
                    <tr id="xuLyPattern" style="display: none">
                        <td id="tdLoaiXuLy" valign="middle" align="left" class="Col_Left"> 
                        </td>                        
                    </tr>
                </tbody>    
            </table>
        </td>       
    </tr>  
</table>
<script type="text/javascript" language="javascript">    
    
    CMS.Presenters.Presenters.ListManager.MainScreenPresenter.LoadViewFromModel(function(response)
    {       
        subRenderList(response);
    });     
    
    function subRenderList(response){  
        util.removeAllRows("tbdDiaBan", { filter:function(tr) {
            return (tr.id != "diaBanPattern" && tr.id != "diaBanTitle");
        }});
        util.removeAllRows("tbdXuLy", { filter:function(tr) {
            return (tr.id != "xuLyPattern" && tr.id != "xuLyTitle");
        }});
        util.removeAllRows("tbdLoaiDon", { filter:function(tr) {
            return (tr.id != "loaiDonPattern" && tr.id != "loaiDonTitle");
        }});
        util.removeAllRows("tbdLinhVuc", { filter:function(tr) {
            return (tr.id != "linhVucPattern" && tr.id != "linhVucTitle");
        }});      

        if(response.value != null)
        {                        
            var dtKQ = response.value; 
            var sumNow = dtKQ[0];
            var sumDonThu = dtKQ[1];
            var dtXL = dtKQ[2];             
            var dtLD = dtKQ[3];
            var dtLV = dtKQ[4];
            var dtDB = dtKQ[5];  
                        
            $("#tdSumNow").html("<strong>Tổng số đơn thư trong ngày: " + sumNow + " đơn thư</strong>"); 
            $("#tdSumDonThu").html("<strong>Tống số đơn thư: " + sumDonThu + " đơn thư</strong>");
            
            for (var k = 0; k < dtLD.length; k++) {
                util.cloneNode("loaiDonPattern", { idSuffix:(k+1) });                
                var loaiDon = "&nbsp; &nbsp; &nbsp; &nbsp; -&nbsp;" + dtLD[k][1] + ": " + dtLD[k][0];
                $("#tdLoaiDon" + (k+1)).html(loaiDon);                
                $("#loaiDonPattern" + (k+1)).attr("style", "display:");                 
            }
            
            for (var l = 0; l < dtLV.length; l++) {
                util.cloneNode("linhVucPattern", { idSuffix:(l+1) });                
                var linhVuc = "&nbsp; &nbsp; &nbsp; &nbsp; -&nbsp;" + dtLV[l][1] + ": " + dtLV[l][0];
                $("#tdLinhVuc" + (l+1)).html(linhVuc);                
                $("#linhVucPattern" + (l+1)).attr("style", "display:");                 
            }
            
            for (var m = 0; m < dtDB.length; m++) {
                util.cloneNode("diaBanPattern", { idSuffix:(m+1) });                
                var diaBan = "&nbsp; &nbsp; &nbsp; &nbsp; -&nbsp;" + dtDB[m][1] + ": " + dtDB[m][0];
                $("#tdDiaBan" + (m+1)).html(diaBan);                
                $("#diaBanPattern" + (m+1)).attr("style", "display:");                 
            }
       
            for (var j = 0; j < dtXL.length; j++) {
                util.cloneNode("xuLyPattern", { idSuffix:(j+1) });                
                var xuLy = "&nbsp; &nbsp; &nbsp; &nbsp; -&nbsp;" + dtXL[j][1] + ": " + dtXL[j][0];
                $("#tdLoaiXuLy" + (j+1)).html(xuLy);                
                $("#xuLyPattern" + (j+1)).attr("style", "display:");                 
            }            
        }         
    }
</script>